package com.hmall.mq.config;

import com.hmall.mq.client.RabbitClient;
import com.hmall.mq.properties.RabbitmqProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass(RabbitClient.class)
@EnableConfigurationProperties(RabbitmqProperties.class)
public class RabbitMqAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public RabbitClient rabbitClient() {
        return new RabbitClient();
    }
}
